#include<bits/stdc++.h>
using namespace std;
long long n,dp[100010][3];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		long long a,b,c;
		scanf("%lld%lld%lld",&a,&b,&c);
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c;
	}
	printf("%lld",max(dp[n][0],max(dp[n][1],dp[n][2])));
	return 0;
}
